<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="Risk_Default" Title="APM - Task Risk Impact Assessment" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ul id="path">
        <asp:Panel ID="pnlActive2" runat="server" Visible="true">
            <li><a href="../Home.aspx">Home</a> &gt;</li>
            <li>Workflow/Tasks &gt;</li>
            <li>Task Risk Impact Assessment</li>
        </asp:Panel>
    </ul>
    <h3 class="risk"><span>Risk Assessment</span></h3>
    <div id="content">
        <p>
        </p>
        <asp:Panel ID="pnlSearch" runat="server" Width="100%">
            <table class="table">
                <tr align="center">
                    <th colspan="2">
                        Quick Search</th>
                </tr>
                <tr>
                </tr>
                <tr>
                    <td align="left" colspan="2" style="padding: 0 0 0 0;">
                        <asp:RadioButtonList ToolTip="Select to search by Application Name or by Application ID."
                            runat="server" ID="rdsearchType" AutoPostBack="false" TextAlign="Right" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="true" Value="0"> Search by Application Name</asp:ListItem>
                            <asp:ListItem Value="1">Search by Application ID</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2" style="padding: 0 0 0 0;">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <asp:TextBox ValidationGroup="search" CssClass="input" ID="txtSearch" Width="220"
                                        runat="server" MaxLength="50"></asp:TextBox>
                                    <asp:Button ID="btnSearch" runat="server" ValidationGroup="search" OnClick="btnSearch_Click"
                                        Text="Search"  />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ValidationGroup="search" ID="reqAppName" runat="server"
                                        ControlToValidate="txtSearch" ErrorMessage="Required Field: Application Name/ID"
                                        Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="reguAppName" runat="server" ControlToValidate="txtSearch"
                                        Display="None" ErrorMessage="Invalid Input: Application Name/ID" ValidationExpression="<%$ AppSettings:AppNameRegEx %>"
                                        ValidationGroup="search"></asp:RegularExpressionValidator>
                                    &nbsp;Example - Microsoft Word or 56</td>
                                <asp:ValidationSummary ValidationGroup="search" ID="commonValidation" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        <asp:Label ID="lblResult" runat="server" Text="Select Application" Visible="false"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        <asp:ListBox Width="275" ID="lstApplicationNames" Rows="5" runat="server" Visible="False">
                        </asp:ListBox>
                        <asp:RequiredFieldValidator ValidationGroup="Go" ID="RequiredFieldValidator1" runat="server"
                            ControlToValidate="lstApplicationNames" ErrorMessage="No application was selected."
                            Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="left">
                        <asp:Button ID="btnGo" runat="server" ValidationGroup="Go" Text="Select" Visible="false" OnClick="btnGo_Click" />
                        <asp:ValidationSummary ValidationGroup="Go" ID="ValidationSummary1" runat="server"
                            HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                            DisplayMode="BulletList" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="pnlAppAssessment" runat="server" BorderColor="Silver" BorderWidth="1px"
            Visible="false" Width="100%">
            <asp:Panel ID="pnlBorder" BorderWidth="10" BorderColor="White" runat="server">
                <asp:Panel runat="server" ID="pnlAppInfo1">
                    <h4>
                        Application Information</h4>
                    <asp:Label CssClass="current" ID="lblAppIDText" runat="server">Application ID:</asp:Label>
                    <asp:Label ID="lblAppID" runat="server"></asp:Label><asp:HiddenField runat="server"
                        ID="hfAppID" />
                    <br />
                    <asp:Label CssClass="current" ID="lblAppInfoText" runat="server">Application Name:</asp:Label>
                    <asp:Label ID="lblAppName" runat="server"></asp:Label>
                    <br />
                    <asp:Label CssClass="current" ID="lblVersionText" runat="server">Version Number:</asp:Label>
                    <asp:Label ID="lblVersion" runat="server"></asp:Label>
                    <br />
                    <asp:Label CssClass="current" ID="lblStatusText" runat="server">Summary Assessment Status:</asp:Label>
                    <font color='red'>
                        <asp:Label ID="lblStatus" runat="server"></asp:Label></font>
                    <asp:Panel ID="pnlError" runat="server" Visible="false">
                        <asp:Label CssClass="current" ID="lblErrorText" runat="server">Status Details:</asp:Label>
                        <font color='red'>
                            <asp:Label ID="lblError" runat="server"></asp:Label></font>
                    </asp:Panel>
                    <hr />
                </asp:Panel>
                <h4>
                    Risk Assessment</h4>
                <asp:Panel ID="pnlAssessmentNotCompleted" runat="server" Visible="false">
                    <table width="100%" style="vertical-align: top;">
                        <asp:Repeater ID="rptCategory" runat="server" OnItemDataBound="rptCategory_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:TextBox ID="txtCatID" Text='<%# Eval("QuestionCategoryID") %>' runat="server"
                                            ReadOnly="true" Visible="false"></asp:TextBox>
                                        <asp:TextBox ID="txtCatName" Text='<%# Eval("CategoryName") %>' runat="server" ReadOnly="true"
                                            Visible="false"></asp:TextBox>
                                        <asp:Label ID="lblCatName" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("CategoryName").ToString()) %>'
                                            Font-Bold="true" runat="server"></asp:Label>
                                        <asp:Repeater ID="rptQuestions" runat="server">
                                            <ItemTemplate>
                                                <tr valign="top">
                                                    <td style="width: 450px;">
                                                        <asp:TextBox ID="txtQuestID" Text='<%# Eval("QuestionID") %>' runat="server" ReadOnly="true"
                                                            Visible="false"></asp:TextBox>
                                                        <asp:TextBox ID="txtQuestionTxt" Text='<%# Eval("QuestionText") %>' runat="server"
                                                            ReadOnly="true" Visible="false" Width="450px" CssClass="input"></asp:TextBox>
                                                        <asp:Label ID="lblSeqOrder" runat="server"></asp:Label>.
                                                        <asp:Label ID="lblQuestText" runat="server" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("QuestionText").ToString()) %>'></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:DropDownList ID="ddlAnswers" DataTextField="AnswerText" DataValueField="AnswerID"
                                                            Width="220px" runat="server" AppendDataBoundItems="True">
                                                            <asp:ListItem Value="">No Selection</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:RequiredFieldValidator ID="rfvAnswer" runat="server" ControlToValidate="ddlAnswers"
                                                            SetFocusOnError="true" Display="None" ValidationGroup="Answer"></asp:RequiredFieldValidator>
                                                        <br />
                                                    </td>
                                                </tr>
                                                <%--<tr><td colspan="2">&nbsp;</td></tr>--%>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <tr>
                                                    <td colspan="2">
                                                        &nbsp;</td>
                                                </tr>
                                            </FooterTemplate>
                                        </asp:Repeater>
                            </ItemTemplate>
                            <SeparatorTemplate>
                            </SeparatorTemplate>
                            <FooterTemplate>
                                <%--<tr>
                            <td>&nbsp;
                            </td>
                        </tr>--%>
                            </FooterTemplate>
                        </asp:Repeater>
                    </table>
                </asp:Panel>
                <asp:Panel ID="pnlAssessmentCompleted" runat="server" Visible="false">
                    <table width="100%" style="vertical-align: top;">
                        <asp:Repeater ID="rtpCategory1" runat="server" OnItemDataBound="rptCategory1_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:Label ID="lblCatName" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Category").ToString()) %>'
                                            Font-Bold="true" runat="server"></asp:Label>
                                        <asp:Repeater ID="rptQuestions1" runat="server">
                                            <ItemTemplate>
                                                <tr valign="top">
                                                    <td style="width: 450px;">
                                                        <asp:Label ID="lblSeqOrder1" runat="server"></asp:Label>.
                                                        <asp:Label ID="lblQuestText1" runat="server" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Question").ToString()) %>'></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="lblAnswers1" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("Answer").ToString()) %>'
                                                            runat="server"></asp:Label>
                                                        <br />
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                <tr>
                                                    <td colspan="2">
                                                        &nbsp;</td>
                                                </tr>
                                            </FooterTemplate>
                                        </asp:Repeater>
                            </ItemTemplate>
                            <SeparatorTemplate>
                            </SeparatorTemplate>
                            <FooterTemplate>
                            </FooterTemplate>
                        </asp:Repeater>
                    </table>
                </asp:Panel>
                <asp:Panel ID="pnlButtons" runat="server" Visible="true" Width="100%">
                    <table>
                        <tr>
                            <td>
                                <asp:Button ID="btnSave" CausesValidation="false" OnClick="SaveClick" runat="server"
                                    Text="Save" />
                                <asp:Button ID="btnSubmit" ValidationGroup="Answer" CausesValidation="true" OnClick="SubmitClick"
                                    runat="server" Text="Submit" />
                                <asp:Button ID="btnCancel" runat="server" Text="Back" OnClick="CancelClick" />
                                <asp:ValidationSummary ValidationGroup="Answer" ID="ValidationSummary" runat="server"
                                    HeaderText="All questions must be answered." ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="SingleParagraph" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </asp:Panel>
        </asp:Panel>
    </div>
</asp:Content>
